package at.fhooe.mc.master.clc.server.domain.objectify;

import java.util.Date;

import at.fhooe.mc.master.clc.server.domain.AbstractTestable;
import at.fhooe.mc.master.clc.server.domain.ISmallEntity;

import com.googlecode.objectify.annotation.Entity;
import com.googlecode.objectify.annotation.Id;
import com.googlecode.objectify.annotation.Index;
import com.googlecode.objectify.annotation.Unindex;

@Entity
public class SmallEntityObjectify extends AbstractTestable implements ISmallEntity
{
	@Id private Long id;
	
	@Index private String stringField;
	@Unindex private int intField;
	@Unindex private double doubleField;
	@Unindex private Date dateField;
	
	public SmallEntityObjectify() {}
	
	public SmallEntityObjectify(boolean generate)
	{
		if (generate)
		{
			this.stringField = "String Test Field";
			this.intField = 42;
			this.doubleField = 42.42;
			this.dateField = new Date();
		}
	}

	public Long getId()
	{
		return id;
	}

	@Override
	public String getStringField()
	{
		return stringField;
	}

	@Override
	public int getIntField()
	{
		return intField;
	}

	@Override
	public double getDoubleField()
	{
		return doubleField;
	}

	@Override
	public Date getDateField()
	{
		return dateField;
	}
	
	@Override
	public void setDistinguishable(String uuid)
	{
		this.stringField = uuid;
	}
	
	@Override
	public String getDistinguishable()
	{
		return this.stringField;
	}
}
